package cn.jingzhuan.fm.di.component

import cn.jingzhuan.fm.mvp.contract.FMAudioContract
import cn.jingzhuan.fm.ui.activity.FMAudioActivity
import dagger.Module
import dagger.Provides
import dagger.Subcomponent
import dagger.android.AndroidInjector


@Subcomponent(modules = [(FMAudioModule::class)])
interface FMAudioComponent : AndroidInjector<FMAudioActivity> {

    @Subcomponent.Builder
    abstract class Builder : AndroidInjector.Builder<FMAudioActivity>() {
        abstract fun newModule(module : FMAudioModule):Builder

        override fun seedInstance(instance: FMAudioActivity) {
            newModule(FMAudioModule(instance))
        }
    }
}

@Module
class FMAudioModule(val mView: FMAudioContract.View) {
    @Provides
    fun getView() = mView
}
